﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace ArrayList测试
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList list1 = new ArrayList();
            list1.Add(3);
            list1.Add("5");
            list1.Add(true);//向ArrayList中添加元素,object
            //list1.AddRange(

            int[] nums = { 5,9,11,35,55};
            //foreach (int i in nums)//数组都是从Array类继承的
            //{
            //    list1.Add(i);
            //}
            list1.AddRange(nums);//等价于上面的遍历Add

            nums[0] = 999999;//

            //Console.WriteLine(list1.Count);

            //list1.Add("hwhwwhwhwhwh");
            //for (int i = 0; i < list1.Count; i++)
            //{
            //    object obj1 = list1[i];
            //    Console.WriteLine(obj1);
            //}
            foreach (object obj1 in list1)
            {
                Console.WriteLine(obj1);
            }

                Console.ReadKey();
        }
    }
}
